import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect: '/index',
    children:[
      {
        path: '/index',
        component: () => import("../views/home/IndexView")
      },{
      path:'/searchList',
      component:()=>import("../views/SearchView.vue")
    } , {
        path: '/detail',
        component: () => import("../views/home/DetailsView.vue")
      }

    ]
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/recruit',
    component: () => import('../views/RecruiterView.vue'),
    redirect:'/recruit/positionManage/',
    children:[
      {
        path: 'positionManage/',
        component: () => import('../views/recruiter/PositionManageView.vue'),
        redirect:'/recruit/positionManage/allPosition',
        children:[
          {
            path: 'allPosition',
            component: () => import('../views/recruiter/positionManage/AllPositionView.vue')
          },{
            path: 'open',
            component: () => import('../views/recruiter/positionManage/Open.vue')
          },{
            path: 'notOpen',
            component: () => import('../views/recruiter/positionManage/NotOpen.vue')
          },{
            path: 'auditFailed',
            component: () => import('../views/recruiter/positionManage/AuditFailed.vue')
          },
        ]
      },
      {
        path: '/recommend',
        component: () => import(/* webpackChunkName: "about" */ '../views/recruiter/PositionManageView.vue')
      },
      {
        path: '/chatWith',
        component: () => import(/* webpackChunkName: "about" */ '../views/recruiter/PositionManageView.vue')
      },
      {
        path: '/postPosition',
        component: () => import(/* webpackChunkName: "about" */ '../views/recruiter/PostPositionView.vue')
      }
    ]
  },
  {
    path: '/reg',
    name:'reg',
    component: ()=>import('../views/passport/Reg.vue')
  },
  {
  path: '/addJobApplicat',
    component: ()=>import('../views/passport/AddJobApplicat.vue')
  },
  {
    path: '/addRecruiter',
    component: ()=>import('../views/passport/AddRecruiter.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
